package com.wdh.kjs.Adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.wdh.kjs.R;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * Created by feifei on 2016/4/20.
 */

public class TuijianAdapter extends BaseAdapter {

    private List<HashMap<String, String>> data=new ArrayList<HashMap<String,String>>();
    private Context context;
    private HashMap<String, String> maps=new HashMap<String, String>();
    public TuijianAdapter(Context context,List<HashMap<String, String>> data) {
        this.data=data;
        this.context = context;
    }
    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;

        if (convertView == null) {
            viewHolder = new ViewHolder();
            convertView = View.inflate(context, R.layout.shouye_tuijian, null);
            viewHolder.tuijian_text = (TextView) convertView.findViewById(R.id.tuijian_text);
            viewHolder.tuijian_text1 = (TextView) convertView.findViewById(R.id.tuijian_text1);
            viewHolder.tuijian_text2 = (TextView) convertView.findViewById(R.id.tuijian_text2);
            viewHolder.tuijian_text3 = (TextView) convertView.findViewById(R.id.tuijian_text3);
            viewHolder.tuijian_text4 = (TextView) convertView.findViewById(R.id.tuijian_text4);
            viewHolder.tuijian_text5 = (TextView) convertView.findViewById(R.id.tuijian_text5);
            viewHolder.tuijian_text6 = (TextView) convertView.findViewById(R.id.tuijian_text6);
            convertView.setTag(viewHolder);
        }else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        maps  = data.get(position);

        viewHolder.tuijian_text.setText(maps.get("style"));
        viewHolder.tuijian_text1.setText(maps.get("name"));
        viewHolder.tuijian_text2.setText(maps.get("money"));
        viewHolder.tuijian_text3.setText(maps.get("per"));
        viewHolder.tuijian_text4.setText(maps.get("day"));
        viewHolder.tuijian_text5.setText(maps.get("total"));
        viewHolder.tuijian_text6.setText(maps.get("per1"));


        return convertView;
    }
    class ViewHolder{
      TextView tuijian_text;
        TextView tuijian_text1;
        TextView tuijian_text2;
        TextView tuijian_text3;
        TextView tuijian_text4;
        TextView tuijian_text5;
        TextView tuijian_text6;

    }
}